package App.Repository;

import App.Entity.Task;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * Created by yu on 2017/7/20.
 */
@Repository
public interface TaskRepository extends CrudRepository<Task,Long>
{
    public List<Task> getTasksByProjectIdOrderByPublicTimeDesc(Long ProjectId);

    @Query("select count(id) from Task task where task.projectId=:projectId")
    public long getTaskCountByProjectId(@Param("projectId") Long ProjectId);

    public List<Task> getTasksByProjectIdAndStatusOrderByPublicTimeDesc(Long ProjectId,int status);

    public List<Task> findByProjectIdAndStatusAndPublicTimeGreaterThanOrderByPublicTimeDesc(Long projectId,int status,Long publicTime);
}
